$(function(){
	var commentId = wsCommon.getUrlParam('commentId');
	var uploader;

	var comment = {
		getData: function() {
			$.ajax({
                url: wsCommon.host + '/api/memberComments/discuss',
                dataType: wsCommon.jsonType,
				data: {
					commentId: commentId
				},
                success: function(res) {
                    if(res.code == 1) {
						if(!res.result) {
                            wsCommon.setCookie('go_back_link', window.location.href);
                            window.location.href = './passport-login.html';
							return;
                        }
						var comment = res.data.comment;
						var picTpl = '';
						$.each(comment.showPicList, function(index, item) {
							picTpl +='<div class="thumbnail-item">\
										<img  src="'+item+'">\
									</div>';
						})

						var tpl = '<div class="f-cutline"></div>\
                        <div class="f-item f-goods">\
                            <div class="fi-info">\
                                <div class="comment-goods">\
                                    <div class="p-img"><a href="./info.html?goodsId='+comment.goodsId+'&catId='+comment.catId+'" target="_blank"><img src="'+comment.goodsPic+'"></a></div>\
                                    <div class="p-name"><a href="./info.html?goodsId='+comment.goodsId+'&catId='+comment.catId+'" target="_blank">'+comment.goodsName+'</a></div>\
                                    <div class="p-price"><strong>¥'+comment.productPrice+'</strong></div>\
                                </div>\
                            </div>\
                            <div class="fi-operate">\
                                <p class="fi-operate-time">'+comment.commentTimeStr+'</p>\
                                <div class="fop-item fop-star   z-tip-warn">\
                                    <div class="fop-label">商品满意度</div>\
                                    <div class="fop-main">\
                                        <span class="commstar active">\
                                            <span class="star star1"><i class="face"></i></span>\
                                            <span class="star star2"><i class="face"></i></span>\
                                            <span class="star star3"><i class="face"></i></span>\
                                            <span class="star star4"><i class="face"></i></span>\
                                            <span class="star star5"><i class="face"></i></span>\
                                            <span class="star-info highlight">'+comment.point+'分</span>\
                                        </span>\
                                    </div>\
                                    <div class="fop-tip"><i class="tip-icon"></i><em class="tip-text"></em></div>\
                                </div>\
                                <p class="fi-operate-time"></p>\
                                <div class="fop-item ">\
                                    <div class="fop-main">\
                                        <div class="m-imgshow f-imgshow" style="margin-left:40px;margin-top:20px;" >\
                                            <div class="thumbnail-list" style="position: relative;">'+picTpl+'</div>\
                                        </div>\
                                    </div>\
                                    <div class="fop-tip"><i class="tip-icon"></i><em class="tip-text"></em></div>\
                                </div>\
                            </div>\
                        </div>';
						$('.form-part1').html(tpl);
						$('.star' + comment.point).addClass('active');

                    } else {
                        iosOverlay({
                            text: res.reason,
                            duration: 1000
                        });
                    }
                },
                error: function(e) {
				}
            })
		},

		init: function() {
			this.getData();
		}
	}

	comment.init();
})
